home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
019a
/
amac40.zip
/
RFR005.QM
< prev
next >
Wrap
Text File
|
1991-08-02
|
12KB
|
231 lines
* RFR005.QM
* Written By Tom Hogshead
* [ See RFRMxx.QM For Use ]
* August 2, 1991
* Key Subfile Description
* ===== =============== ====================================================
* @(0) Count Number Of Words In A Document,
* Words Sep. By Space
* @(9) Count Number Of Words In A Document,
* Words=Letters/Num.
* @(1) Count Number Of Characters In A Block
* @(2) Count Number Of Characters In A Document
*
* {e:\up\RFRM*}--Return To RFRMxx.QM
*
*-- eoi
*
* ┌─────────────────────────────────────────────────────────────┐
* │@(0) Counts words in a document, words separated by spaces │
* └─────────────────────────────────────────────────────────────┘
* @0 differs from @9 in that a "word" with @0 is considered any string
* separated by at least one space. @9 macro considers a "word" to be at
* least one letter or number separated by a space or the following word
* separators: !@#$%^&*'()+|-=\,./;'[]<>?:"{} ... @9 counts words like
* "can't" as two words; @0 counts them as one word.
*
* @0 is a little longer and slower than @9, but if it's important to
* you that words be considered as "any string separated by at least
* one space", this is the macro to use.
* Test macro using the calibrated file WORD (46 words).
* -----------------------------------
* @0 Macro To Count Words In Document
* -----------------------------------
*
* [ Number of WORDS in document ] = [ Number of LINES in temp file ]
*
@0 Macrobegin
*----Toggle Insert ON-------------------*
Insertline "A" Cursorleft "A" * Insert test line
Endline Jtrue WASON: * If not at endline-Insert is ON
Toggleinsert Jump WASOFF: * Or Insert is off-toggle ON
WASON: Cursorleft * Clean up cursor movement
WASOFF: Cursorleft Delline * Clean up cursor movement
*----Copy Document To Temp File---------*
BegFile Markblockbegin * Mark document
EndFile Markblockend *
Editfile "NUL" Return Quit * Quit NUL of loaded
Editfile Return * Load NUL
Copyblock Unmarkblock * Copy doc to temp file
Endfile Addline Begfile * Add blank line at end
*----Split Words One Word Per Line------*
COUNT1: Find " " Return Return * Find first space
COUNT2: Return * Put next word on next line
NOSPACE: CursorDown * Move down to next line
Jfalse DELBLANKLINES: * If can't move down must be
* on last line, then begin to
* delete all blank lines
Cursorup * Move back up one line
Repeatfind * Find another space
JTrue COUNT2: * Put next word on next line
*----Delete Blank Lines-----------------*
DELBLANKLINES: Begfile * Get to begin of file
CHK4BLANK: Endline Begline * Check if line has text
Jtrue NOTBLANK: * If so, go to NOTBLANK
Delline * Or line is blank, delete it
Jtrue CHK4BLANK: * Go check next line
NOTBLANK: Endpara *ELSE Move to paragraph end
Cursordown * Move down to next line
Jtrue CHK4BLANK: * If not eof, check again
*----Get Word Count---------------------*
GETCOUNT:
Findreplace " " Return Delline * Remove all extra spaces
Return "GN" Return *
Makebotofscreen * WORD COUNT = # LINES
*
* 82 bytes Wed 02-20-1991 16:54:02
* 83 bytes Mon 07-15-1991 11:06:17 (TH @0, changed ! to NUL)
* ┌────────────────────────────────────────────────────────────────────┐
* │@(9) Macro To Count Words In Document, Words are letters and numbers│
* └────────────────────────────────────────────────────────────────────┘
* This macro counts the number of words in a document. A "word" is at
* least one letter or number separated by a space or the following word
* separators:
* !@#$%^&*'()+|-=\,./;'[]<>?:"{}
* If it's important to you that words be considered as "any string
* separated by at least one space", macro @0 below is the macro to
* use. The @9 macro counts words like "can't" as two words; @0 counts
* them as one word.
* Test macro using the calibrated file WORD (19 words).
*
* -----------------------------------
* @9 Macro To Count Words In Document
* -----------------------------------
* [ Number of WORDS in document ] = [ Number of LINES in temp file ]
*
@9 Macrobegin *
*----Be Sure Last Line Is Blank---------*
Endfile Begline * Check for blank line at end
Jfalse START: Addline * If last line is NOT blank,
* test fails, then addline
*----Copy Words To Scratch Buffer-------*
START: Begfile Insertline * Insert blank line at top to
* be sure to find first word
Wordright Markword * Mark first word
Cursorup Delline * Delete blank line
Storescrbuff "1" Return * Store word to scratch buffer
COUNT: Cursordown * Check if on last line
Jfalse GETCOUNT: Cursorup * If can't cursor down, must
* be on last line, go to
* GETCOUNT, or cursorup
*ELSE
WordRight MarkWord * Move to next word and mark it
Jfalse COUNT: * If at endline, no word exists
* so COUNT again
*ELSE
Appendscrbuff "1" Return * Append word to scratch
Jump COUNT: * and go-to COUNT again
*----Get Word Count---------------------*
GETCOUNT: Editfile "NUL" Return Quit * Quit NUL if loaded
Editfile Return * Load temp file to count words
Getscrbuff "1" Return * Make list of words
Unmarkblock Endfile * WORD COUNT = # LINES
*
* 50 bytes Sat 10-13-1990 03:18:33
* 54 bytes Mon 07-15-1991 11:09:03 (TH @9, changed ! to NUL)
*
* ----------------------------------------------------------------------
* @(1) Count Number Of Characters In A Block
* ----------------------------------------------------------------------
* To: Mike Butler, RelayNet, May 4, 1991 15:16:09
* MB> Is there any way to create a macro to count the number of
* MB> characters in a block?
* This QEdit macro determines a block's byte size and provides a means
* to calculate the Number of Characters in a block. Block Byte Size can
* be useful for uploading CompuServe files where upload file descriptions
* are limited to 465 bytes:
* Block Byte Size = Size of block if it were a file
* Character Count = (Block Byte Size) minus 2 x (Number of Lines)
* Mark a block. Block need not be closed. Block byte size will be shown in
* a window and in front of the last line of a copy of the block. Press
* <enter> to remove the window from the screen and return to the our
* starting point. To determine the number of actual characters in a block,
* including spaces between text, subtract 2 x (number of lines in window)
* from (byte size). The paragraph below with asterisks is 274 bytes, and
* has 274 - 4 x 2 = 266 characters including spaces.
* NOTE: c:temp and c:dir are temporary files created and deleted from the
* disk. Rename files and run QMAC if this causes problems. This macro has
* only been tested with DOS 3.3. SaveFile is used rather than WriteBlock
* in case c:temp and c:dir exist before running.
@1 Macrobegin
Editfile "c:temp" Return * Load temp file
killfile Quit * Kill/quit c:temp
EditFile Return * Load empty c:temp
Copyblock * Copy block to temp file
EndFile DelLine * Delete extra blank line
Savefile * Save temp file to get size
DOS "Dir " Currentfilename * Get DIR list of c:temp
">C:dir" Return Return * Save DIR list of c:temp
Editfile "C:dir" Return * Load DIR list
Gotoline "5" Return * CursorDown to c:temp line
Wordright Markword Copy * Copy size to scrap
Killfile Quit * Kill/quit c:dir
Editfile "c:temp" Return * Load c:temp
Killfile * Kill it
Endfile Begline *
"Block size=" Paste * Paste block size at bottom
Makebotofscreen * Re-position
Pause * Press <enter> to remove block size
Quit * Character Count = Block Size
* minus 2 x Number of Lines
* 114 bytes Sat 05-04-1991 15:15:25
* The following macro counts the number of characters in a document. After
* running, the byte size of the document *without* spaces is shown in
* column 1 on the last line. Subtract 2 x number of lines from the byte
* size to get the number of actual characters in the document.
*
* ----------------------------------------------------------------------
* @(2) Count Number Of Characters In A Document
* ----------------------------------------------------------------------
@2 Macrobegin
UnMarkBlock * Un-mark all blocks
BegFile Markblockbegin * Mark document
EndFile Markblockend *
Editfile "c:temp" Return * Load empty c:temp
Killfile Quit * Kill/quit c:temp
Editfile Return * Load empty temp file
Copyblock Unmarkblock * Copy document to temp file
Findreplace " " Return * Replace all single spaces
DelLine Return "GN" Return * With Blanks, globally
DELBLANKLINES: *
Begfile * Get to begin of file
CHK4BLANK: *
Endline Begline * Check if line has text
Jtrue NOTBLANK: * If so, go to NOTBLANK
Delline * Or line is blank, delete it
Jtrue CHK4BLANK: * Go check next line
NOTBLANK: *
Endpara *ELSE Move to paragraph end
Cursordown * Move down to next line
Jtrue CHK4BLANK: * If not eof, check again
GETCOUNT: *
Savefile * Save temp file to get size
DOS "DIR " Currentfilename * Get DIR list of c:temp
">C:dir" Return Return * Save DIR list of c:dir
Editfile "C:dir" Return * Load DIR list
Gotoline "5" Return * Cursordown to c:temp line
Wordright Markword Copy * Copy size to scrap
Killfile Quit * Kill/quit c:dir
Editfile "c:temp" Return * Load compressed c:temp
Killfile * Kill c:temp disk copy
Begline "Byte size=" Paste * Paste byte size at bottom
Makebotofscreen * Re-position
Pause * Press <enter> to remove window
Quit * Character Count = Byte Size
* minus 2 x Number of Lines
* 92 bytes Wed 02-20-1991 17:02:29
* 141 bytes Sat 05-04-1991 15:38:07 changed temp file names, added pause
* corrected gotoline "5"